
      !##########################################################
      !This file contains the node based gravity forward formula
      !the unit for length is km,and for gravity is mGal
      !  dg:
      !         dg_node(x,z)
      !  dgx:
      !         dgx_node(x,z)     
      !  dgz:
      !         dgz_node(x,z)  
      !  dgzz:
      !         dgzz_node(x,z)
      !##########################################################
      real*8 function dg_node(x,z)
      implicit none
      real*8 x,z
      real*8 G
      G=6.67 !For length:km, gravity: mGal
      if(z.lt.0) z=-z
      dg_node=x*dlog(x*x+z*z)+2*z*datan2(x,z)
      dg_node=dg_node*G
      end function
      ! dg_x******************************************
      real*8 function dgx_node(x,z)
      implicit none
      real*8 x,z
      real*8 G
      G=6.67 !For length:km, gravity: mGal
      if(z.lt.0) z=-z
      dgx_node=-dlog(x*x+z*z)
      dgx_node=dgx_node*G
      end function
      ! dg_z********************************************
      real*8 function dgz_node(x,z)
      implicit none
      real*8 x,z
      real*8 G
      G=6.67 !For length:km, gravity: mGal
      if(z.lt.0) z=-z
      dgz_node=datan2(z,x)
      dgz_node=dgz_node*G
      end function
      ! dg_zz******************************************
      real*8 function dgzz_node(x,z)
      implicit none
      real*8 x,z
      real*8 G
      G=6.67 !For length:km, gravity: mGal
      if(z.lt.0) z=-z
      dgzz_node=-x/(x*x+z*z)
      dgzz_node=dgzz_node*G
      end function
      !##########################################################
